<%--
  Created by IntelliJ IDEA.
  User: 王文涛
  Date: 2021/5/27
  Time: 9:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page isELIgnored="false" %>
<html>
<head>
    <title>Title</title>
    <link type="text/css" rel="stylesheet" href="../bootstrap-3.3.7-dist/css/bootstrap.min.css">
</head>
<body>
<script type="text/javascript" src="../js/jquery-3.3.1.js"></script>
<script type="text/javascript" src="../bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<script type="text/javascript">


    $(function () {
        $("#frm").submit(function () {
            $.ajax({
                url: "/admin/update",
                data: {
                    a_id: $("input[name=a_id]").val(),
                    a_tel: $("input[name=a_tel]").val(),
                    a_uname: $("input[name=a_uname]").val(),
                    a_pword: $("input[name=a_pword]").val(),
                    a_email: $("input[name=a_email]").val(),
                },
                type: "post",
                dataType: "json",
                success: function (data) {
                        if (data.code==1){
                            window.location.href="myinfo.jsp"
                        }else {
                            window.location.href="err.jsp"
                        }
                }
            })
            alert($(this).serialize());
        })
    })
    /* $.ajax({
         url:"/adm
in/update",
         data:{},
         type:"post",
         dataType:"json",
         success:function (data) {


         }

     })*/


</script>
<div class="container" style="background-color: white;">
    <div class="row" style="margin-left: 40px">
        <h3>这是您的信息</h3>
    </div>
    <div class="row" style="margin-top: 40px;">
        <div class="col-md-10 col-md-offset-1">
            <table class="table table-bordered table-striped table-hover">
                <tr>
                    <th>ID</th>
                    <th>电话</th>
                    <th>用户名</th>
                    <th>密码</th>
                    <th>邮箱</th>
                </tr>
                <tr>
                    <th>${sessionScope.admin.a_id}</th>
                    <th>${sessionScope.admin.a_tel}</th>
                    <th>${sessionScope.admin.a_uname}</th>
                    <th>${sessionScope.admin.a_pword}</th>
                    <th>${sessionScope.admin.a_email}</th>
                </tr>
                <tr>
                    <td colspan="5">
                        <h5>个人信息</h5>
                        <a href="javascript:void(0)" data-toggle="modal" data-target="#mymodal">编辑您的信息</a>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <hr>
    <div class="modal fade" id="mymodal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="exampleModalLabel">请输入你的详细地址</h4>
                </div>
                <div class="modal-body">
                    <form id="frm">
                        <div class="form-group">
                            <label for="id" class="control-label">Id:</label>
                            <input name="a_id" readonly value="${sessionScope.admin.a_id}" class="form-control" id="id">
                        </div>
                        <div class="form-group">
                            <label for="tell" class="control-label">电话:</label>
                            <input name="a_tel" value="${sessionScope.admin.a_tel}" class="form-control" id="tell">
                        </div>
                        <div class="form-group">
                            <label for="name" class="control-label">姓名:</label>
                            <input name="a_uname" value="${sessionScope.admin.a_uname}" class="form-control" id="name">
                        </div>
                        <div class="form-group">
                            <label for="password" class="control-label">密码:</label>
                            <input name="a_pword" value="${sessionScope.admin.a_pword}" class="form-control"
                                   id="password">
                        </div>
                        <div class="form-group">
                            <label for="emial" class="control-label">邮箱:</label>
                            <input name="a_email" value="${sessionScope.admin.a_email}" class="form-control" id="emial">
                        </div>
                        <div class="form-group">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                            <button type="submit" class="btn btn-primary">提交</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>
